<template>
    <view :class="'STH_images_panel STH_images_style_' + size">
        <view class="STH_images_box">
            <block v-for="(item, idx) in ItemList" :key="idx">
                <view @tap="link" :data-info="item" :class="'STH_images STH_iDefault_' + size + ' ' + (item.Fsrc.length == 0 ? 'hidden' : '')">
                    <image mode="widthFix" :src="item.Fsrc" :alt="item.Ftitle"></image>
                </view>
            </block>
        </view>
    </view>
</template>

<script>
// component/images/images.js
var util = require('../../utils/util.js');
export default {
    data() {
        return {
            prop: null,
            ItemList: [],
            size: '0'
        };
    },
    /**
     * 组件的属性列表
     */
    props: {
        con: {
            type: Object
        }
    },
    mounted() {
        // 处理小程序 ready 生命周期
        this.$nextTick(() => this.ready());
    },
    /**
     * 组件的方法列表
     */
    methods: {
        ready: function () {
            var that = this;
            var prop = JSON.parse(that.con.prop);
            var ItemList = that.con.ItemList;
            ItemList.map(function (item, index) {
                item.Fsrc = util.changeBigpic(item.Fsrc);
            });
			that.prop = prop;
			that.ItemList = ItemList;
			that.size = prop.size; 
        },

        link: function (e) {
            var that = this;
            var data = e.currentTarget.dataset.info;
            var url = '';
            if (util.isEmpty(data.Ftypeid)) {
                return;
            }
            //微页面
            if (data.Ftype == 1) {
                url = '/pages/wpage/wpage?Ftypeid=' + data.Ftypeid;
            } else if (data.Ftype == 2) {
                //商品分类
                url = '/pages/proList/proList?Ftypeid=' + data.Ftypeid;
            } else if (data.Ftype == 3) {
                //单商品
                url = '/pages/proDetail/proDetail?Ftype=3&Ftypeid=' + data.Ftypeid;
            } else if (data.Ftype == 4) {
                //闪购活动
                url = '/pages/proDetail/proDetail?Ftype=4&Ftypeid=' + data.Ftypeid;
            } else if (data.Ftype == 5) {
                //团购活动
                url = '/pages/proDetail/proDetail?Ftype=5&Ftypeid=' + data.Ftypeid;
            } else if (data.Ftype == 6) {
                //拼团活动
                url = '/pages/proDetail/proDetail?Ftype=6&Ftypeid=' + data.Ftypeid;
            }
            if (url == '') {
                return;
            }
            uni.navigateTo({
                url: url
            });
        }
    },
    created: function () {}
};
</script>
<style>
@import './images.css';
</style>
